import ServiceRequest from './request'
import {BASE_URL,TIMEOUT} from './config'

const service = new ServiceRequest({
  baseURL:BASE_URL,
  timeout:TIMEOUT
})

// 多个实例
export const service2 = new ServiceRequest({
  baseURL:'http://codercba.com:1888/airbnb/api',
  timeout:60000,

  interceptors:{
    requestSuccessFn:(config) =>{
      console.log("单个实例的请求成功的拦截")
      return config
    },
    requestFailureFn:(err) =>{
      return err
    },
    responseSuccessFn:(res) =>{
      console.log("单个实例的响应成功的拦截")
      return res
    },
    responseFailureFn:(err) =>{
      return err
    },
  }
})

export default service